/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package BUS;

import java.util.ArrayList;

/**
 *
 * @author ldtung_it
 */
public class StringFunctions {
    /**
     * Cut string by string is given
     * @param s string input;
     * @param a string signals;
     * @return arraylist<String> result;
     */
    public static ArrayList<String> cutStringByChac(String s, String a) {
        ArrayList<String> alTemp = new ArrayList<String>();
        int beginIndex = 0;

        s = s + a;
        int index = s.indexOf(a);
        while (index != -1) {
            alTemp.add(s.substring(beginIndex, index));
            beginIndex = index + 1;

            index = s.indexOf(a, index + 1);
        }
        return alTemp;
    }
}
